package com.dolphin.serviceprice.generator;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.OutputFile;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;

import java.util.Collections;

public class MysqlGenerator {
    public static void main(String[] args) {
        FastAutoGenerator.create("jdbc:mysql://127.0.0.1:3306/service-price?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true",
                "root",
                "root")
                .globalConfig(builder -> {
                    builder.author("小新")
                            .fileOverride().outputDir("D:\\code\\idea_project\\online-taxi-public\\online-taxi-public\\service-price\\src\\main\\java");
                })
                .packageConfig(builder -> {
                    builder.parent("com.dolphin.serviceprice")
                            .pathInfo(Collections.singletonMap(OutputFile.mapperXml,
                                    "D:\\code\\idea_project\\online-taxi-public\\online-taxi-public\\service-order\\src\\main\\java\\com\\dolphin\\serviceprice\\mapper"));
                })
                .strategyConfig(builder -> {
                    builder.addInclude("price_rule");
                })
                .templateEngine(new FreemarkerTemplateEngine())
                .execute();
    }
}
